<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="language" content="en" />
        <title><?php echo CHtml::encode($this->pageTitle); ?></title>
        <?php echo $this->facebook?>
        <link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro&subset=latin,vietnamese' rel='stylesheet' type='text/css'>
        <link rel="stylesheet" type="text/css" href="<?php echo urlCss(); ?>bootstrap.min.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo urlCss(); ?>style.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo urlJs(); ?>slider/jquery.bxslider.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo urlJs(); ?>rating/jquery.rating.css" />
        <!--<script src="<?php echo urlJs(); ?>jquery-1.10.2.js"></script>-->

    </head>
    <body>
        
        <!-- header -->
        <?php $this->widget('HeaderWidget')?>
        <!-- end header -->
        <?php $this->widget('SliderWidget')?>
        <!-- navigation -->
        <?php $this->widget('NavigationWidget'); ?>
        <div class="main_width">
        <?php
        $this->widget('booster.widgets.TbAlert', array(
            'fade' => true,
            'closeText' => '&times;', // false equals no close link
            'events' => array(),
            'htmlOptions' => array(),
            'userComponentId' => 'user',
            'alerts' => array(// configurations per alert type
                // success, info, warning, error or danger
                'success' => array('closeText' => '&times;'),
                'info', // you don't need to specify full config
                'warning' => array('closeText' => false),
                'error' => array('closeText' => '&times;')
            ),
        ));
        ?>
        </div>
        <?php echo $content; ?>

        <div id="h_menu_footer" class="main_width">
            <ul class="h__menu_footer">
                <li class="h_menu_title">
                    Hỗ trợ khách hàng
                </li>
                <li class="h_menu_item">
                    <a href="<?php echo yii::app()->createUrl('news/view',array('id' => 12,'title' => 'dieu-khoan-su-dung')) ?>">Điều khoản sử dụng</a>
                </li>
                <li class="h_menu_item">
                    <a href="<?php echo yii::app()->createUrl('news/view',array('id' => 13,'title' => 'huong-dan-mua-hang')) ?>">Hướng dẫn mua hàng </a>
                </li>
                <li class="h_menu_item">
                    <a href="<?php echo yii::app()->createUrl('news/view',array('id' => 14,'title' => 'chinh-sach-bao-mat')) ?>">Chính sách bảo mật</a>
                </li>
            </ul>
            <ul class="h__menu_footer">
                <li class="h_menu_title">
                    Thông tin
                </li>
                <li class="h_menu_item">
                    <a href="<?php echo yii::app()->createUrl('news/view',array('id' => 15,'title' => 've-7buy')) ?>">Về 7Buy</a>
                </li>
                <li class="h_menu_item">
                    <a href="<?php echo yii::app()->createUrl('news/view',array('id' => 16,'title' => 'tin-tuyen-dung')) ?>">Tin tuyển dụng</a>
                </li>
                <li class="h_menu_item">
                    <a href="<?php echo yii::app()->createUrl('news/view',array('id' => 17,'title' => 'tin-khuyen-mai')) ?>">Tin khuyễn mãi</a>
                </li>
            </ul>
            <ul class="h__menu_footer social_icon">
                <li class="h_menu_title">
                    kết nối với chúng tôi
                </li>
                <li class="h_menu_item">
                    <img src="<?php echo UrlImage() ?>facebook.png" /><a href="#">Facebook</a>
                </li>
                <li class="h_menu_item">
                    <img src="<?php echo UrlImage() ?>youtube.png"/><a href="#">Youtube</a>
                </li>
                <li class="h_menu_item">
                    <img src="<?php echo UrlImage() ?>google.png"/><a href="#">Google</a>
                </li>
                <li class="h_menu_item">
                    <img src="<?php echo UrlImage() ?>twitter.png"/><a href="#">Twitter</a>
                </li>
            </ul>
            <ul class="h__menu_footer">
                <li class="h_menu_title">
                    Hình thức thanh toán
                </li>
                <li><img src="<?php echo UrlImage() ?>visa.png"  /></li>
                <li class="h_menu_item" >
                    <strong >Thanh toán an toàn</strong><br/>
                    <img src="<?php echo UrlImage() ?>payment_logo.png" width="169" height="83" style="margin-top: 10px;" />
                </li>

            </ul>
            <form id="h_news" action="<?php echo Yii::app()->createUrl('home/register');?>">
                <div id="h_news_title">ĐĂNG KÍ NGAY NHẬN THÔNG TIN KHUYẾN MÃI TỪ 7 BUY</div>
                <div id="h_news_gender">
                    Bạn là: <input type="radio" name="gender" class="gender" value="1" checked="checked"/>Nam <input type="radio" name="gender" class="gender" value="2"/>Nữ
                </div>
                <input type="text" name="email" id="news_email" />
                <input type="button" name="email" id="news_submit" value="Đăng Kí"/>
            </form>
            <div class="clearBoth"></div>
        </div>
        <div id="all_category">
            <?php $this->widget('AllCategoryWidget')?>
        </div>
        <div id="footer" class="main_width">
            <a href="<?php echo yii::app()->createUrl('home/index') ?>"><img src="<?php echo UrlImage() ?>logo.png" id="footer_logo" /></a>
            <div style="width:730px;float:right;color: #ccccff">
            <?php
                $home = News::model()->findByPk(HOME_PAGE);
                if ($home != null) {
                    echo $home->description;
                }
            ?>
            </div>
            <br class="clearBoth"/>
        </div>
        <ul id="live_chat">
            <li>
                <a href="#">
                    <img src="<?php echo UrlImage() ?>top.png" /><br />
                    Lên trên
                </a>
            </li>
            <li>
                <a href="#">
                    <img src="<?php echo UrlImage() ?>live_chat.png" /><br />
                    live chat
                </a>
            </li>

            <li>
                <a href="<?php echo yii::app()->createUrl('Cart/index') ?>">
                    <img src="<?php echo UrlImage() ?>cart.png" /><br />
                    Giỏ hàng
                </a>
            </li>
        </ul>
        
        <script src="<?php echo urlJs(); ?>slider/jquery.bxslider.js"></script>
        <script src="<?php echo urlJs(); ?>bootstrap.min.js"></script>
        <script src="<?php echo urlJs(); ?>rating/jquery.MetaData.js"></script>
        <script src="<?php echo urlJs(); ?>rating/jquery.rating.js"></script>
        <script src="<?php echo urlJs(); ?>jquery.elevatezoom.js"></script>
        <script src="<?php echo urlJs(); ?>jquery.form.js"></script>
        
        <script>
            function fixMenu(){
                var show = false;
                $('#container_h_navigation .h_sub_menu').each(function(){
                    console.log($(this).parents('.item_navigation').attr('class'));    
                    if($(this).is(":visible") || $(this).parents('.item_navigation').hasClass('active_click')){
                        $('#container_h_navigation').addClass('fix_navigation');
                        show = true;
                        return false;
                    }
                });
                if(!show){
                    $('#container_h_navigation').removeClass('fix_navigation');
                }
            }
            $(document).ready(function(){
                /**
                 * menu
                 */
                $("#h_navigation li").not("#log_navi").mouseover(function(){
                    //$(this).find('.h_sub_menu').slideDown();
                    $(this).addClass('active');
                    fixMenu();
                });
                $("#h_navigation li").not("#log_navi").mouseout(function(){
                    //$(this).find('.h_sub_menu').stop();
                    //$(this).find('.h_sub_menu').slideUp();
                    $(this).removeClass('active');
                    fixMenu();
                });
            
                /**
                 *
                 */
                $(".detail_class_link").mouseover(function(){
                    $($(this).data('target')).modal('show');
                });
                
                /**
                 * banner
                 */
                $('.bxslider').bxSlider({controls: false,auto:true});
                /*
                 * 
                 */
                $("#container_thub .thub").on('click',function(){
                    $("#container_thub .thub").removeClass('active');
                    $('#main_image img').attr('src',$(this).data('img'));
                    $(this).addClass('active');
                    $('#main_image img').elevateZoom();
                });
                $('#main_image img').elevateZoom(); 
                /**
                 * 
                 */
                $('.detail_property .item_property_value').on('click',function(){
                    $(this).parents('.detail_property').find('.item_property_value input[type=radio]').prop('checked', false);
                    $(this).find('input[type=radio]').prop('checked', true);
                    $(this).parents('.detail_property').find('.item_property_value').removeClass('active');
                    $(this).addClass('active');
                });
            
                /*
                 * 
                 */
                $('.button_cart_update').on('click',function(){
                    var id = $(this).data('id');
                    $("#action_cart_"+id).val($(this).data('action'));
                    $("#item_cart_"+id).submit();
                });
                
                /**
                 * 
                 */
                $(window).scroll(function(){
                  var sticky = $('#container_h_navigation'),
                      scroll = $(window).scrollTop();
                  if (scroll >= 482) 
                      sticky.addClass('fixed');
                  else 
                      sticky.removeClass('fixed');
                });
                
                /**
                 * 
                 */
                $("#h_navigation > li").not('#log_navi').each(function(){
                    var url = document.URL;
                    var tag_li = $(this);
                    $(this).find('a').each(function(){
                        //console.log($(this).attr('href'),url.indexOf($(this).attr('href')));
                        if(url.indexOf($(this).attr('href')) > -1){
                            tag_li.addClass('active_click');
                        }
                    });
                    fixMenu();
                });
                
                /**
                 * 
                 */
                $('.h_sub_menu').each(function(){
                    width_fix = ($(this).find('li').size() * 200);
                    if(width_fix < 988)
                        width_fix = 988;
                    $(this).width(width_fix);
                });
                
                /**
                 * 
                 */
                $('#news_submit').on('click',function(){
                    //update banner
                    $('#h_news').ajaxSubmit({
                        dataType: 'json',
                        success: function(data){
                            if(data.error){
                                alert(data.message);
                            }else{
                                alert('bạn đã đăng ký thành công');
                            }
                        }
                    });
                });
                
                /**
                * 
                */
                $('#link_login').on('click',function(){
                    if($(this).hasClass('active_pupop')){
                        $(this).removeClass('active_pupop');
                        $("#container_popup_login").hide();
                    }else{
                        $(this).addClass('active_pupop');
                        $("#container_popup_login").show();
                    }
                    return false;
                });
                
                /**
                 * 
                 */
                $("#ajax_login").on('click',function(){
                    $("#container_popup_login form").ajaxSubmit({
                        dataType: 'json',
                        success: function(data){
                            if(data.error){
                                $('#ajax_login_message').html(data.message);
                            }else{
                                window.location = document.URL;
                            }
                        }
                    });
                });
                
            });
        </script>
        <script type='text/javascript'>window._sbzq||function(e){e._sbzq=[];var t=e._sbzq;t.push(["_setAccount",9282]);var n=e.location.protocol=="https:"?"https:":"http:";var r=document.createElement("script");r.type="text/javascript";r.async=true;r.src=n+"//static.subiz.com/public/js/loader.js";var i=document.getElementsByTagName("script")[0];i.parentNode.insertBefore(r,i)}(window);</script>
    </body>
</html>